package main

import (
	"fmt"
	"net"
)

func main() {

	address := "127.0.0.1:9999"

	// 建立连接
	conn, err := net.Dial("tcp", address)

	if err != nil {
		fmt.Printf("Net connect error=%v\n", err)
		return
	}

	line := "hello world\n"

	// 写出数据
	_, err = conn.Write([]byte(line))

	if err != nil {
		fmt.Printf("Write line error=%v\n", err)
	}

	// 关闭连接
	conn.Close()
}
